package com.stone.springboot.Test.pojo;


import lombok.Data;

import java.io.Serializable;

/**
 * Created by stone on 2017/8/25.
 */
@Data
public final class ResultBean<T> implements Serializable {

	private static final long serialVersionUID = -6975042788987316902L;

	public static final int SUCCESS = 0 ;

	public static final int FAIL = 1;

	public static final int NO_PERMISSION = 2 ;

	private String msg = "success";

	private int code = SUCCESS;

	private T data ;

	public ResultBean() {
		super();
	}

	public ResultBean(T data) {
		this.data = data;
	}

	public ResultBean(Throwable e) {
		super();
		this.msg = e.toString();
		this.code = FAIL;
	}

	public String getMsg() {
		return msg;
	}

	public ResultBean setMsg(String msg) {
		this.msg = msg;
		return this;
	}

	public int getCode() {
		return code;
	}

	public ResultBean setCode(int code) {
		this.code = code;
		return this;
	}

	public T getData() {
		return data;
	}

	public ResultBean setData(T data) {
		this.data = data;
		return this;
	}

	@Override
	public String toString() {
		return "ResultBean{" + "msg = '" + msg + '\'' + ", code = " + code + ", data = " + data + '}';
	}
}
